package com.threadPool;



import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class DemoTest {


    public static void main(String[] args) {

        Executors.newCachedThreadPool();

        ThreadPoolExecutor threadPoolExecutor =new ThreadPoolExecutor(2, 5,
                0L, TimeUnit.MILLISECONDS,
                new LinkedBlockingQueue<Runnable>());

            threadPoolExecutor.execute(() ->{
                DemoA DemoA=new DemoA();
                DemoA.query();
            });
            threadPoolExecutor.execute(() ->{
                DemoB demoB=new DemoB();
                demoB.query();
            });

         threadPoolExecutor.shutdown();

        System.out.println("===="+Thread.currentThread().getName());

    }

}
